﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'usp_UPDMS_FIT_FIGURE_MGT_Insert')
	BEGIN
		DROP Procedure usp_UPDMS_FIT_FIGURE_MGT_Insert
	END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
/******************************************************************************
**	Name : usp_UPDMS_FIT_FIGURE_MGT_Insert
**	Desc : 건강지수관리를 저장한다.
**	Test Exec Query : Exec usp_UPDMS_FIT_FIGURE_MGT_Insert
**	Called by : Fit_Dac_UPDMS_FIT_FIGURE_MGT.cs
**	Program ID : Fit1012m
**	Auth : 송시명
**	Date : 2014-05-20
*******************************************************************************
**	Change History
*******************************************************************************
**	Date:		Author:		Description:
**	--------	--------	---------------------------------------
**	
*******************************************************************************/
CREATE PROC [dbo].[usp_UPDMS_FIT_FIGURE_MGT_Insert]
@Seq int,
@Measure_Dt nvarchar(10),
@Body_Weight decimal(10,1),
@BMI decimal(10,2),
@Soft_Lean_Mass decimal(10,2),
@Body_Fat_Mass decimal(10,2),
@Body_Fat_Ratio decimal(10,2),
@Waist_Hip_Fat_Ratio decimal(10,2),
@Memo nvarchar(max),
@Attach_File_Info nvarchar(max),
@Create_User nvarchar(20),
@Create_Dt datetime,
@Update_User nvarchar(20),
@Update_Dt datetime
AS
SET NOCOUNT OFF

DECLARE @New_Seq int

INSERT INTO UPDMS_FIT_FIGURE_MGT (
       Measure_Dt,
       Body_Weight,
       BMI,
       Soft_Lean_Mass,
       Body_Fat_Mass,
       Body_Fat_Ratio,
       Waist_Hip_Fat_Ratio,
       Memo,
       Create_User,
       Create_Dt,
       Update_User,
       Update_Dt
)
VALUES (
       @Measure_Dt,
       @Body_Weight,
       @BMI,
       @Soft_Lean_Mass,
       @Body_Fat_Mass,
       @Body_Fat_Ratio,
       @Waist_Hip_Fat_Ratio,
       @Memo,
       @Create_User,
       GETDATE(),
       @Update_User,
       GETDATE()
)

SET @New_Seq = @@IDENTITY

--첨부파일 저장
EXEC usp_UPDMS_COM_FILE_Insert_Xml @New_Seq, 'Fit1012m', @Attach_File_Info

GO